function! s:load_airlinetab() abort "autocmd FileType python,c,cpp TagbarOpen let g:airline_powerline_fonts = 1 set showtabline=2 let g:airline#extensions#tabline#buffer_nr_show = 1 let g:airline#extensions#tagbar#enabled = 1 let g:airline#extensions#tagbar#searchmethod = 'nearest' let g:airline#extensions#tabline#left_sep = ' ' let g:airline#extensions#tabline#left_alt_sep = '>' ""enable tabline let g:airline#extensions#tabline#enabled = 1 let g:airline#extensions#tabline#buffer_idx_mode = 1
  let g:airline#extensions#tabline#formatter = 'unique_tail'
  let g:airline#extensions#tabline#show_buffers = 1
  let g:airline#extensions#tabline#tablineat = 1
  
  let g:airline_powerline_fonts = 1
  let g:airline#extensions#tabline#enabled = 1
  let g:airline#extensions#tabline#fnamemod = ':t'
  let g:airline#extensions#tabline#switch_buffers_and_tabs = 1
  let g:airline#extensions#tabline#buffer_idx_mode = 1


  let g:airline#extensions#tabline#buffer_idx_format = {
          \ '0': '[0] ',
          \ '1': '[1] ',
          \ '2': '[2] ',
          \ '3': '[3] ',
          \ '4': '[4] ',
          \ '5': '[5] ',
          \ '6': '[6] ',
          \ '7': '[7] ',
          \ '8': '[8] ',
          \ '9': '[9] '
          \}
  nmap <leader>1 <Plug>AirlineSelectTab1
  nmap <leader>2 <Plug>AirlineSelectTab2
  nmap <leader>3 <Plug>AirlineSelectTab3
  nmap <leader>4 <Plug>AirlineSelectTab4
  nmap <leader>5 <Plug>AirlineSelectTab5
  nmap <leader>6 <Plug>AirlineSelectTab6
  nmap <leader>7 <Plug>AirlineSelectTab7
  nmap <leader>8 <Plug>AirlineSelectTab8
  nmap <leader>9 <Plug>AirlineSelectTab9
  nmap <leader>0 <Plug>AirlineSelectTab0
  nmap <leader>- <Plug>AirlineSelectPrevTab
  nmap <leader>+ <Plug>AirlineSelectNextTab)
  
  nnoremap <silent> <Leader>qq :Bw<CR>
endfunction





function! s:load_barbaar() abort
lua << EOF
vim.g.bufferline = {
  icons = 'both'
}
EOF
" Move to previous/next
nnoremap <Tab> :BufferPrevious<CR>
nnoremap <S-Tab> BufferNext<CR>
" nnoremap <silent>    <leader>,> :BufferPrevious<CR>
" nnoremap <silent>    <leader>.> :BufferNext<CR>
" Re-order to previous/next
" nnoremap <silent>    <leader><> :BufferMovePrevious<CR>
" nnoremap <silent>    <leader>>> :BufferMoveNext<CR>
" Goto buffer in position...
nnoremap <silent>    <leader>1 :BufferGoto 1<CR>
nnoremap <silent>    <leader>2 :BufferGoto 2<CR>
nnoremap <silent>    <leader>3 :BufferGoto 3<CR>
nnoremap <silent>    <leader>4 :BufferGoto 4<CR>
nnoremap <silent>    <leader>5 :BufferGoto 5<CR>
nnoremap <silent>    <leader>6 :BufferGoto 6<CR>
nnoremap <silent>    <leader>7 :BufferGoto 7<CR>
nnoremap <silent>    <leader>8 :BufferGoto 8<CR>
nnoremap <silent>    <leader>9 :BufferLast<CR>
" Pin/unpin buffer
" nnoremap <silent>    <leader>p> :BufferPin<CR>
" Close buffer
nnoremap <silent> <Leader>qq :BufferClose<CR>
" Wipeout buffer
"                          :BufferWipeout<CR>
" Close commands
"                          :BufferCloseAllButCurrent<CR>
"                          :BufferCloseAllButPinned<CR>
"                          :BufferCloseBuffersLeft<CR>
"                          :BufferCloseBuffersRight<CR>
" Magic buffer-picking mode
" nnoremap <silent> <C-s>    :BufferPick<CR>
" Sort automatically by...
" nnoremap <silent> <Space>bb :BufferOrderByBufferNumber<CR>
" nnoremap <silent> <Space>bd :BufferOrderByDirectory<CR>
" nnoremap <silent> <Space>bl :BufferOrderByLanguage<CR>
" nnoremap <silent> <Space>bw :BufferOrderByWindowNumber<CR>
" 
" Other:
" :BarbarEnable - enables barbar (enabled by default)
" :BarbarDisable - very bad command, should never be used
endfunction

nnoremap <Tab> :bn<CR>
nnoremap <S-Tab> :bp<CR>
if exists("g:useairline_tabline") &&  g:useairline_tabline
  map <Leader>bb :Buffers<cr>
  set showtabline=2
  nnoremap <Tab> :bn<CR>
  nnoremap <S-Tab> :bp<CR>
  call s:load_airlinetab()
endif


